<template>
  <search-table
      title="用户"
      :headers="headers"
      :searchData="searchUser"
      :doDelete="deleteUser"
      :do-add="addUser"
      :do-update="updateUser"
  ></search-table>
</template>

<script>
import {pageUser,addUser,updateUser,deleteUser} from "@/api/organization/user"
import SearchTable from "@/components/search-table"
export default {
  name: 'tables',
  components:{SearchTable},
  data() {
    return {
      headers:[
        {key:'id',label:'ID',forbiddenEdit:true},  //默认type : input ，默认允许在添加界面添加相关字段 forbiddenEdit禁止编辑
        {key:'username',label:'用户名'},
        {key:'name',label:'姓名'},
        {key:'nickName',label:'昵称'},
        {key:'phone',label:'电话'},
        {key:'email',label:'邮件',type:"input"},
        {key:'gender',label:'性别',type:"radio",options:[{key:1,label:'男'},{key:2,label:'女'},{key:3,label:'其他'}]},
        {key:'createTime',label:'创建日期',type:"datetime",forbiddenEdit:true},
        {key:'updateTime',label:'更新日期',type:"date",forbiddenEdit:true},
      ]
    }
  },
  mounted() {

  },
  methods: {
    searchUser(params){
      return pageUser(params);
    },
    updateUser(data){
      return updateUser(data)
    },
    deleteUser(data){
      return deleteUser(data.id)
    },
    addUser(data){
      return addUser(data)
    }
  }
}
</script>

<style scoped lang="scss">

</style>
